/*
 * Position.cpp
 *
 *  Created on: 05/01/2012
 *      Author: luiz
 */
#include <iostream>
#include <stdlib.h>
#include <stdio.h>

#include "Position.h"

Position::Position(PositionType x, PositionType y):x_(x),y_(y) {
}


Position::~Position() {

}

Position::Position(const Position & position) {

    x_ = position.x_;
    y_ = position.y_;



}

Position & Position::operator =(const Position & position){
    if(&position == this){
        return *this;
    }
    x_ = position.x_;
    y_ = position.y_;


    return *this;
}

bool Position::operator ==(const Position & b) const
 {
    if(x_ == b.x_ && y_ == b.y_){
        return true;
    }
    else {
        return false;
    }
}


void Position::set_x(PositionType x)
{
    x_ = x;
}


const Position::PositionType Position::x() const
{
    return x_;
}


void Position::set_y(PositionType y)
{
    y_ = y;
}


bool Position::operator !=(const Position& b) const
                {
    return !(*this == b );
                }

int Position::compare(const Position& b) const
{
    if(x_ <= b.x_){
        if(x_ < b.x_){
            return -1;
        } else  if( y_ <= b.y_){
            if(y_ < b.y_){
                return -1;
            } else {
                return 0;
            }
        }
    }
     return 1;
}

bool Position::operator <(const Position& b) const
{
    if(this->compare(b) < 0){
        return true;
    } else {
        return false;
    }
}

bool Position::operator >(const Position& b) const
{
    if(this->compare(b) > 0 ){
        return true;
    } else {
        return false;
    }
}

bool Position::operator <=(const Position& b) const
                                        {
    if(this->compare(b) < 1){
        return true;
    } else {
        return false;
    }


                                        }

bool Position::operator >=(const Position& b) const
                                {
    if(this->compare(b) >-1 ){
        return true;
    } else {
        return false;
    }

                                }



const Position::PositionType Position::y() const
{
    return y_;
}


